package com.jinxinol.basic.system.web;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;

import com.jinxinol.basic.system.domain.SysSeqsNo;
import com.jinxinol.basic.system.service.ISysSeqsNoService;
import com.jinxinol.core.common.BaseAction;
import com.jinxinol.core.common.ContextHelper;
import com.jinxinol.core.common.PageModel;
/**
 * 
 * @company Jinxin Computer Corp.
 * @author LXD
 * @email 247428412@qq.com
 * @description 自动生成单据编号
 * @date 2012-09-05
 */
public class SysSeqsNoAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static final Log logger = ContextHelper.getLogger(SysSeqsNoAction.class);
	
	private String id; // SYS_SEQS_NO 中的主键字段ORDER_TYPE_NO varchar2 类型
	private SysSeqsNo sysSeqsNo;// SysSeqsNo 实体类对应数据库中的 SYS_SEQS_NO
	private String msg; // 消息
	private List<SysSeqsNo> sList;
	private PageModel<SysSeqsNo> pm = new PageModel<SysSeqsNo>();
	@Resource
	ISysSeqsNoService sysSeqsNoService;

	/**
	* @Title: checkIsExist 
	* @Description: 查询时候已经存在相同的数据
	* @author LXD
	* @email 247428412@qq.com
	 */
	public void checkIsExist() {
		int count;
		try {
			count = sysSeqsNoService.selectCountByType(sysSeqsNo);
			response.getWriter().write(""+count);
			response.getWriter().close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	/** 添加一条新的SYS_SEQS_NO 记录 */
	public String insertS() {
		try {
			sysSeqsNoService.insertS(sysSeqsNo);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "insertSsuccess";
	}

	/** 查询所有 SYS_SEQS_NO 记录  分页 */
	public String findAllSSN() {
		try {
			if (sysSeqsNo == null) {
				sysSeqsNo = new SysSeqsNo();
			}
			pm = sysSeqsNoService.findOnPage(sysSeqsNo,pm);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "findAllSSNsuccess";
	}

	/** 删除一条SYS_SEQS_NO 记录 */
	public String deleteS(){
		try {
			sysSeqsNoService.deleteS(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		msg = "删除一条记录";
		return "deleteSsuccess";
	}

	/** 通过id 找到对应的一条 SYS_SEQS_NO 记录 */
	public String findByIdS() {
		try {
			sysSeqsNo = sysSeqsNoService.findByIdS(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "findByIdSsuccess";
	}

	/** 修改一条SYS_SEQS_NO 记录 */
	public String updateS(){
		try {
			sysSeqsNoService.updateS(sysSeqsNo);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "updateSsuccess";
	}

	public SysSeqsNo getSysSeqsNo() {
		return sysSeqsNo;
	}

	public void setSysSeqsNo(SysSeqsNo sysSeqsNo) {
		this.sysSeqsNo = sysSeqsNo;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public ISysSeqsNoService getSysSeqsNoService() {
		return sysSeqsNoService;
	}

	public void setSysSeqsNoService(ISysSeqsNoService sysSeqsNoService) {
		this.sysSeqsNoService = sysSeqsNoService;
	}

	public List<SysSeqsNo> getSList() {
		return sList;
	}

	public void setSList(List<SysSeqsNo> list) {
		sList = list;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	public PageModel<SysSeqsNo> getPm() {
		return pm;
	}
	public void setPm(PageModel<SysSeqsNo> pm) {
		this.pm = pm;
	}

}
